package com.datamigration;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DataTransfer {

	/**
	 * @param args
	 * @throws ClassNotFoundException
	 * @throws SQLException
	 */
	public static void main(String[] args) throws ClassNotFoundException,
			SQLException {
		// Class.forName("oracle.jdbc.driver.OracleDriver");
		Class.forName("com.mysql.jdbc.Driver");
		Connection bssConn = null;
		bssConn = DriverManager.getConnection(
				"jdbc:mysql://localhost:3306/bss", "root", "nopass");

		Connection bssNewConn = null;
		bssNewConn = DriverManager.getConnection(
				"jdbc:mysql://localhost:3306/bssnew", "root", "nopass");
		bssNewConn.setAutoCommit(false);

		ResultSet attendent_record = bssConn.prepareStatement(
				"Select * from attendent_record").executeQuery();

		while (attendent_record.next()) {
			ResultSet bssNew = bssNewConn.prepareStatement(
					"Select * from activity").executeQuery();
		}

		bssNewConn.commit();
		bssNewConn.close();
		bssConn.close();

	}

}
